package com.vr.xuecheng.content.controller;

import com.vr.xuecheng.base.response.Result;
import com.vr.xuecheng.content.model.dto.CourseAuditDTO;
import com.vr.xuecheng.content.service.ICourseAuditService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author hzh
 * @date 2025/03/19
 * 课程审核
 */
@Slf4j
@RestController
@Tag(name = "课程审核")
@RequestMapping("/courseaudit")
@RequiredArgsConstructor
public class CourseAuditController {
    private final ICourseAuditService courseAuditService;

    /**
     * @param courseId 课程id
     * @return {@code Result<String> }
     * 提交审核
     */
    @Operation(summary = "提交审核")
    @PostMapping("/commit/{course-id}")
    public Result<String> commitAudit(@PathVariable("course-id") Long courseId) {
        return Result.toResult(courseAuditService.commitAudit(courseId));
    }

    /**
     * @param req 完成审核的参数
     * @return {@code Result<String> } 结果
     * 完成审核
     */
    @Operation(summary = "完成审核")
    @PostMapping("/complete")
    public Result<String> completeAudit(@RequestBody CourseAuditDTO req) {
        return Result.toResult(courseAuditService.completeAudit(req));

    }
}
